<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>欢迎进入IT服务管理系统</title>
<meta name="description" content="博尔信软件有限公司">
<meta name="keywords" content="博尔信软件有限公司">
<meta name="Copyright" Content="博尔信软件有限公司 版权所有 2012">
<%@ include file="/WEB-INF/include/include.jsp" %>
</head>
<body>
</body>
<script>
	Ext.QuickTips.init();
    Ext.onReady(function(){
    	var tap = Ext.create('Ext.tab.Panel', {
    					margins:'0 0 0 0',
					    deferredRender: false,
					    activeTab: 0,     // first tab initially active
					    items: [{
					        title: '工作台',
					        //closable: true,
					        autoScroll: true
					      
					    }]
					})
		function addTab(record){
			var id  = record.data.id;
			var item = tap.getComponent(id)
		  	if(item){
		  		tap.setActiveTab(item);
		  		return ;
		  	}
	    	tap.add({
	    		margins:'0 0 0 0',
	            title: record.data.text,
	            id:record.data.id,
	            closable: true,
	            html: "<iframe id='"+record.data.id+"_tabs' src='"+__context__+record.data.url+"' width='100%' height='100%' ></iframe>"
	        }).show();
    	}
		var store = Ext.create('Pearlsen.pTreeStore', {
		 	autoLoad:true,
		 	handler:'SysMenuLoadHandler',
		 	datasetName:'SysMenuDataSet',
		 	fields: [
	           {name: 'id'},
	           {name: 'text'},
	           {name: 'isexpand'},
	           {name: 'qtip'},
	           {name: 'url'},
	           {name: 'leaf'}
        	],
		 	root: {
                    id:"0",
                    text: 'Root',
                    expanded: true
                    
                }
		});
		var tree = Ext.create('Ext.tree.Panel', {
  				width:200,
                rootVisible: false,
                store: store,
                listeners:{
                	itemclick:function(target,record,index,e,eOpts){
                		addTab(record);
                	}
                }
            });
		
		
    	var viewport = Ext.create('Ext.Viewport', {
            id: 'border-example',
            layout: 'border',
            items:[
			{region:'west',title:'功能菜单',split:true,width: 200,border:true,frame:false,animCollapse:false,minSize: 100,collapseMode:'mini',
			 collapsible: true,margins:'0 0 0 0',layout:'fit',items:tree},
			{region:'center',minSize: 100,split:true,border:true,layout:'fit',margins:'0 0 0 0',items:tap	
	   		 	}
			 ]
    	});
    	
    	
    });

</script>
</html>
